package com.siae.controller;

import com.siae.pojo.University;
import com.siae.pojo.vo.Result;
import com.siae.service.UniversityService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/university")
@Tag(name = "UniversityController",description = "大学信息的操作")
public class UniversityController {
    @Autowired
    private UniversityService universityService;
    @GetMapping
    public Result<List<University>> findAllUniversity(){
        return universityService.findAllUniversity();
    }
    @GetMapping("/{id}")
    public Result<University> getUniversityById(@PathVariable("id") Integer id){
        return universityService.getUniversityById(id);
    }
    @GetMapping("/name")
    public Result<List<University>> getUniversityByName(@RequestParam(name = "name",defaultValue = "") String name){
        return universityService.getUniversityByName(name);
    }
}
